<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>添加问题</title>
	<meta name="decorator" content="default"/>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/business/coursegroup/">事件信息列表</a></li>
		<li class="active"><a href="${ctx}/business/course/addevent?id=${course.id}" >
			<shiro:hasPermission name="business:course:edit">添加问题</shiro:hasPermission>
			</a></li>
	</ul>
	<div class="container-fluid breadcrumb">
		<div class="row-fluid span12">
			<span class="span4">事件名称:${event.name}</span>
			<span class="span4">事件类型:${dic:getLabelByValue(event.type, 'event_type')}</span>
			<span class="span4">事件级别:${dic:getLabelByValue(event.level, 'event_level')}</span>
		</div>
		<div class="row-fluid span12">
			<span class="span4">完成类型: ${dic:getLabelByValue(event.finish, 'event_finish')}</span>
			<span class="span4">是否在线: ${dic:getLabelByValue(event.online, 'event_online')}</span>
			<span class="span4">需要完成次数: ${event.times}</span>
		</div>
		<div class="row-fluid span12">
			<span class="span4">验收人: ${dic:getLabelByValue(event.accepter, 'event_accepter')}</span>
			<span class="span4">是否点评: ${dic:getLabelByValue(event.whetherComment, 'event_comment')}</span>
		</div>
	</div>
	<tags:message content="${message}"/>
	<div class="breadcrumb">
		<form id="form" action="${ctx}/business/event/addorupdatequestion" method="post" class="hide">
			<input type="hidden" name="id" value="${event.id}"/>
			<input type="hidden" name="questionid"  id="questionid"/>
		</form>
		<input id="assignButton" class="btn btn-primary" type="button" value="添加问题"/>
		<script type="text/javascript">
			$("#assignButton").click(function(){
				top.$.jBox.open("iframe:${ctx}/business/question/select2", "添加问题",810,$(top.document).height()-240,{
					buttons:{"确定添加":"ok", "清除已选":"clear", "关闭":true}, bottomText:"通过勾选问题后面的复选框进行添加事件 也可以通过移除按钮来删除已经添加的问题。",submit:function(v, h, f){
						var pre_ids = h.find("iframe")[0].contentWindow.pre_ids;
						var ids = h.find("iframe")[0].contentWindow.ids;
						if (v=="ok"){
                            var can=h.find("iframe")[0].contentWindow.can();
                            if (can=="")
                                top.$.jBox.tip("未给事件【${event.name}】添加问题！", 'info');
                            else {
                                loading('正在提交，请稍等...');
                                //提交代码
								$("#questionid").val(can);
								$("#form").submit();
                                return true;
                            }
					    	return false;
						} else if (v=="clear"){
                            h.find("iframe")[0].contentWindow.clsCheckbox();
							return false;
		                }
					}, loaded:function(h){
						$(".jbox-content", top.document).css("overflow-y","hidden");
					}
				});
			});
		</script>
	</div>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead><tr><th>问题类型</th><th>问题描述</th><th>问题类型</th>
			<shiro:hasPermission name="business:event:edit"><th>操作</th></shiro:hasPermission></tr></thead>
		<tbody>
			<tr>
				<td>${question.title}</td>
				<td>${question.content}</td>
				<td>${dic:getLabelByValue(question.type, 'question_type')}</td>
				<shiro:hasPermission name="business:event:edit"><td>
					<a href="${ctx}/business/event/removeqyuestion?question.id=${question.id}&id=${event.id}"
						onclick="return confirmx('确认要将问题<b>[${question.title}]</b>从<b>[${event.name}]</b>从课程中移除吗？', this.href)">移除</a>
				</td></shiro:hasPermission>
			</tr>
		</tbody>
	</table>
</body>
</html>
